{extend name="public/base" /}

{block name="title"}
<title>{if condition="isset($info)"}编辑{else /}新增{/if}</title>
{/block}

{block name="pjax_container"}
<style>
    .box {
        margin-top: 30px;
        box-shadow: 0 0 3px #1890FF;
    }

    td,
    th {
        text-align: center;
        border: 1px solid #ccc !important;
    }

    .pull-right>a {
        border: none;
        width: 80px;
        height: 35px;
        line-height: 25px;
        font-size: 14px;
        letter-spacing: .5px;
    }

    .box-header.with-border {
        border-bottom: 1px solid #ccc;
    }

    .container {
        width: 100%;
    }

    .box.box-primary {
        border-top-color: transparent;
    }

    td>a {
        margin-left: 10px;
        padding: 5px !important;
    }



    .content-header>.breadcrumb>li {
        color: #999;
    }

    .content-header>.breadcrumb>.active {
        color: #666;
    }

    .content-header {
        height: 51px;

    }

    .btn-primary {
        background-color: #1890FF;
        color: #fff;
        border: none;
        border-radius: 6px !important;
        margin-left: 15px;
    }

    .btn-primary:hover {
        background-color: #1890FF;
        color: #fff;
        border: none;
        opacity: .9;
        border-radius: 6px !important;
    }

    .delete-one {
        background-color: ff4141 !important;
        margin-left: 15px;
        border-radius: 6px;
    }
    .nav-tabs-custom{
        margin-top: 16px;
    }
</style>
<section class="content-header">
    <h4>角色信息</h4>
    <ol class="breadcrumb">
        <li>系统管理</li>
        <li>角色列表</li>
        <li class="active">角色信息</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <form class="form-horizontal" method="POST" action="/{$Think.MODULE_NAME}/{$Think.CONTROLLER_NAME}/{$Think.ACTION_NAME}" onsubmit="return false" >
                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab1" data-toggle="tab">基本参数</a></li>
                        <li class="pull-right"><a href="javascript:history.back(-1)" class="btn btn-sm" style="padding:10px 2px;"><i class="fa fa-list"></i> 返回</a></li>
                    </ul>
                    <input type="hidden" name="id" value="{$info['id']|default=0}" />
                    <div class="tab-content">
                        <div class="tab-pane active" id="tab1">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">角色名称</label>
                                <div class="col-sm-7"><input class="form-control" name="name" value="{$info['name']|default=''}" placeholder="角色名称"></div>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">权限</label>
                        <div class="col-sm-7 rule_node">
                            {volist name="treeMenu" id="v"}
                                {if condition="$v['status'] eq 0"}<?php continue; ?>{/if}
                                <div class="left1 an_type" style="display: flex;flex-direction: column;">
                                    <label class="checkbox-inline" style="display: block">
                                        <input type="checkbox" name="relation[]" value="{$v['id']}" class="minimal" {if condition="in_array($v['id'],$list)"}checked="checked"{/if} > {$v['title']}
                                    </label>
                                    {volist name="v['list']" id="vOne" key="kOne"}
                                        {if condition="$vOne['status'] eq 0"}<?php continue; ?>{/if}
                                        <div class="left2 p_left an_type" style="display: inline-block">
                                            <label class="checkbox-inline" style="display: block">
                                                <input type="checkbox" name="relation[]" value="{$vOne['id']}" class="minimal" {if condition="in_array($vOne['id'],$list)"}checked="checked"{/if} > {$vOne['title']}
                                            </label>
                                            
                                            {volist name="vOne['list']" id="vTwo"}
                                                <div class="left3 p_left an_type" style="display: inline;margin-left: 30px;">
                                                    <label class="checkbox-inline">
                                                        <input type="checkbox" name="relation[]" value="{$vTwo['id']}" class="minimal" {if condition="in_array($vTwo['id'],$list)"}checked="checked"{/if} > {$vTwo['title']}
                                                    </label>
                                                </div>
                                            {/volist}
                                        </div>
                                    {/volist}
                                </div>
                            {/volist}
                        </div>
                    </div>
                    <div class="box-footer">
                        <div class="col-sm-2"></div>
                        <div class="col-sm-7">
                            <div class="btn-group pull-right">
                                <button type="submit" class="btn btn-info pull-right submits" data-loading-text="&lt;i class='fa fa-spinner fa-spin '&gt;&lt;/i&gt; 提交">提交</button>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</section>
<script type="application/javascript">
$(function() {
    /*ajax页面加载icheck，有该控件的页面才需要*/
    $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
        checkboxClass: 'icheckbox_minimal-blue',
        radioClass: 'iradio_minimal-blue'
    });
    $(".minimal").on("ifClicked",function(e){
        if (e.target.checked) {
            $(this).parents(".an_type").eq(0).find(".minimal").iCheck('uncheck');
        } else {
            $(this).parents(".an_type").eq(0).find(".minimal").iCheck('check');
            $(this).parents(".left2").eq(0).find(".minimal").eq(0).iCheck('check');
            $(this).parents(".left1").eq(0).find(".minimal").eq(0).iCheck('check');
        }
    })
    
});
</script>
{/block}